﻿<%@ Page Title="" Language="C#" MasterPageFile="~/ActivitySystemPopUpPage.Master" AutoEventWireup="true" CodeBehind="RolePermission.aspx.cs" Inherits="ActivitySystem.Web.Admin.RolePermission" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <style type="text/css">
        .div_contant
        {
            width: 900px;
        }
        .div_contant_head .sp_head
        {
            font-size: 20px;
            background-color: #4b6c9e;
            color: White;
            width: auto;
            padding-left: 10px;
            padding-right: 10px;
        }
        .div_contant_detail
        {
            border-style: solid;
            border-color: #4c6c9e;
            border-width: 2px;
            padding: 5px;
            margin-bottom: 5px;
        }
    </style>
    <script language="javascript" type="text/javascript">
        function selectAll(obj) {
            var theTable = obj.parentElement.parentElement.parentElement;
            var i;
            var j = obj.parentElement.cellIndex;

            for (i = 0; i < theTable.rows.length; i++) {
                var objCheckBox = theTable.rows[i].cells[j].firstChild;
                if (objCheckBox.checked != null) objCheckBox.checked = obj.checked;
            }
        }
    </script>
    <asp:ScriptManager ID="scriptManager" runat="server" />
    <asp:UpdatePanel ID="updatePanel" runat="server">
        <ContentTemplate>
            <div class="div_contant">
                <div class="div_contant_head">
                    <span class="sp_head">
                        <asp:Literal ID="liRoleName" runat="server">Current Role: </asp:Literal>
                    </span>
                </div>
                <div class="div_contant_detail">
                    <asp:GridView ID="gvPagePermission" runat="server" AutoGenerateColumns="False" DataKeyNames="PageId" Width="100%">
                        <Columns>
                            <asp:TemplateField>
                                <HeaderTemplate>
                                    Page
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="lblPageId" runat="server" Text='<%# Bind("PageId") %>' Visible="false" />
                                    <asp:Label ID="lblPageName" runat="server" Text='<%# Bind("PageName") %>' />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <HeaderTemplate>
                                    <input type="checkbox" onclick="selectAll(this);">
                                    Create
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <asp:CheckBox ID="cbxCreate" runat="server" Checked='<%# Bind("Create") %>' />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <HeaderTemplate>
                                    <input type="checkbox" onclick="selectAll(this);">
                                    Delete
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <asp:CheckBox ID="cbxDelete" runat="server" Checked='<%# Bind("Delete") %>' />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <HeaderTemplate>
                                    <input type="checkbox" onclick="selectAll(this);">
                                    Read
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <asp:CheckBox ID="cbxRead" runat="server" Checked='<%# Bind("Read") %>' />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <HeaderTemplate>
                                    <input type="checkbox" onclick="selectAll(this);">
                                    Update
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <asp:CheckBox ID="cbxUpdate" runat="server" Checked='<%# Bind("Update") %>' />
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <HeaderStyle BackColor="#546E96" ForeColor="#DFDFDF" HorizontalAlign="Left" />
                    </asp:GridView>
                    <div style="margin-top: 10px">
                        <asp:Button ID="btnSubmit" runat="server" Text="Save" OnClick="btnSubmit_Click" />
                    </div>
                </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
